473,419 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Opening a dbf File

Hi,

I'm having some trouble opening a dbf file in my application. I'm
getting an oledb exception with the error message:

Message @"'C:\Work\comp310.dbf' is not a valid path. Make sure that
the path name is spelled correctly and that you are connected to the
server on which the file resides."

It is a valid path as the variable to the dbf is filled from an
openfile dialog. Here's the relevant code (pathName is
"C:\Work\comp310.dbf" in this case):

string dbfConnString = String.Format
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended
Properties=dBase IV", pathName);

oleDA = new OleDbDataAdapter("Select * From myDBF", dbfConnString);

OpenDBF("myDBF");

private DataSet OpenDBF(string tableName)
{
oleDA.Fill(myDS, tableName);
return myDS;
}

Thanks in advance for any advice

Apr 25 '06 #1
1 2669
Hi!

Please do yourself a favor and use the FoxPro and Visual FoxPro OLE DB data
provider, downloadable from msdn.microsoft.com/vfoxpro/downloads/updates.

Since you're using a "free" table your connection string should point to the
directory where the DBFs reside, not to a particular file name. The simplest
form of connection string looks like "Provider=VFPOLEDB.1;Data
Source=C:\Temp\;" .

Point to the specific table in your Select statement as you've done below.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci**************@msn.com www.cindywinegarden.com
"Ctal" <wi********@yahoo.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
Message @"'C:\Work\comp310.dbf' is not a valid path. ... (pathName is
"C:\Work\comp310.dbf" in this case):

string dbfConnString = String.Format
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended
Properties=dBase IV", pathName);

oleDA = new OleDbDataAdapter("Select * From myDBF", dbfConnString);

Apr 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: PM | last post by:
Has anyone found a way to open a file exclusively where it will fail if the file is already open, i have tried the following _FileStream = new FileStream(@"C:\Data.txt", FileMode.Open,...
1
by: Alfons | last post by:
Hello, I have build a program that can do file transferring between a Windows XP computer and a DOS computer via a serial port. The Windows program I have build in C++ with Visual Studio 6.0....
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
5
by: Brad | last post by:
In several aspx applications I export crytal reports to pdf, xls and doc files and then the aspx page writes the selected export file to the client browser. This all works with one small quirk: ...
11
by: aldrin | last post by:
I'm trying to run this code under windows xp sp2 using codeblocks v1.0 compiler with great difficulty.There is no problem with running this under KDevelop in linux. Any help would be greatly...
2
by: Craig | last post by:
Hi there, I'm trying to open colour BMPs using PIL and I'm getting the following errors. Opening a 16 colour BMP I get: Traceback (most recent call last): File "<pyshell#3>", line 1, in...
9
compman9902
by: compman9902 | last post by:
Hello, and thank toy for reading this post. Thus far, this website has helped me a lot, (I have finally finished my encryptor: "site removed by moderator", go to the downloads link) and I will...
15
by: Umesh | last post by:
how to open a website like yahoo.com and use it as input? The following code doesn't work. #include"stdio.h" int main() { FILE *f; f=fopen("http://www.yahoo.com","r"); if(f==NULL)
1
by: Sanjeeva K kanakam | last post by:
Hi all, I am developing one application. In that i have created on report file which contains tables, titles and tree view list also by using HTML tags. I am opening this file in my application it...
34
by: Alexnb | last post by:
Gerhard Häring wrote: No, it didn't work, but it gave me some interesting feedback when I ran it in the shell. Heres what it told me: Traceback (most recent call last): File...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.